<?php

session_start();

require_once '../controllers/admin.guilds.class.php';
require_once '../engine/view.class.php';

$AdminGuilds = new AdminGuild;

if($_SESSION['admin'] == 1 OR $_SESSION['founder'] == 1)
{
    if( ! empty($_POST['guildid']))
    {
        $gid = $_POST['guildid'];
        
        $AdminGuilds -> editGuild($gid);
        $AdminGuilds -> optionAligns($gid);
        
    }
    
    $tags = array(
        'game-name' => $AdminGuilds::__GNAME, 
        'name' => $AdminGuilds -> name, 
        'desc' => $AdminGuilds -> desc,
        'url-site' => $AdminGuilds -> url_site,
        'options-aligns' => $AdminGuilds -> options_aligns,
        'guildid' => $gid
    );

    $view = new view('../views/admin/a_guilds-edit.view.html', $tags);
	$view -> show();
	
} else {

    $tags = array(
        'temp_title' => $g_name, 
        'temp_error' => 'Accesso negato. Non si dispone di privilegi sufficienti.'
    );
    
    $view = new view('style/error.template.html', $tags);
	$view -> show();
}

?>